package com.yangfei.mystudy1020.utils;

import android.app.Activity;
import android.os.Handler;
import android.os.Message;

import java.lang.ref.WeakReference;

/**
 * Created by Yangfei on 2017/10/20.
 */

public class SafeHandlerBase extends Handler {
    protected WeakReference<Activity> mRefActivity;

    public SafeHandlerBase(Activity act) {
        mRefActivity = new WeakReference<>(act);
    }

    public boolean checkRef() {
        final Activity activity = mRefActivity.get();
        if (activity != null) {
            return true;
        }else{
            return false;
        }
    }
}